﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Events;

public class HitItemView : MonoBehaviour {
    public UnityAction submit = null;
    public PointHit point;
	private void Awake()
    {
        point=transform.GetComponent<PointHit>();
    }
    public void InitData(UnityAction action)
    {
        submit = action;
    }

    public void PosUp()
    {
        transform.position = new Vector3(transform.position.x, 0.5f, transform.position.z);
        
        Invoke("Down", 1f);

    }
    public void Down()
    {
        PosDown();
    }

    public void PosDown()
    {
        if(point.flag)
        {
            //发消息得分
            submit();
            point.flag = false;
        }
        transform.position = new Vector3(transform.position.x, -0.5f, transform.position.z);
       
    }

}
